<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>我的身份信息</title>
		<link rel="stylesheet" type="text/css" href="../static/common.css" />
		<link rel="stylesheet" type="text/css" href="static/css/common.css" />
		<link rel="stylesheet" type="text/css" href="static/css/style.css" />
	</head>
	<body>
		<div class="recording" id="List" v-cloak>
			<div class="top clearfix">
				<select class="fl" v-model="type" @change="changeType">
					<option value ="2">我的身份信息</option>
					<option value ="3">历史身份变更</option>
				</select>
				<a href="newwork.html" class="btnBlue fl">添加身份</a>
				<a href="changework.html" class="btnBlue fl">变更身份</a>
			</div>
			<table class="table">
				<thead>
					<tr>
						<th>身份</th>
						<th>单位名称</th>
						<th>部门</th>
						<th>身份类型</th>
						<th>是否主管</th>
						<th>添加时间</th>
						<th>状态</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="value,index in identityList">
						<td>{{value.roleName}}</td>
						<td>{{value.projectName}}</td>
						<td>{{value.departName}}</td>
						<td>{{value.checkType == 2 ? "新增身份" : "身份变更"}}</td>
						<td>{{value.isSupervisor == 1 ? "是" : "否"}}</td>
						<td>{{value.applyTime}}</td>
						<td v-html="value.status"></td>
					</tr>
				</tbody>
			</table>
		</div>
	</body>
</html>
<script src="../static/js/jquery-1.8.3.js" type="text/javascript" charset="utf-8"></script>
<script src="../static/dx.js" type="text/javascript" charset="utf-8"></script>
<script src="../static/js/vue.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var vm = new Vue({
		el:'#List',
		created:function(){
			this.getList();
		},
		data:{
			'type':2,//我的身份信息2 历史变更3
			'identityList':[],//所有信息的list
			
		},
		methods:{
			getList:function(){//获取列表数据
				var	$this=this;
				DX.ajax_method({
					type:'GET',
					url:'/user/emp/findApplications',
					param:{'checkType':$this.type},
					callBack:function back(res){
						if (res.code == '200') {
							
							$this.identityList=res.data.users;
							$.each(res.data.users,function(i,val){
								var x= "";
								switch (val.reviewStatus){
									case -1:
										x = '<span class="red">已拒绝<span>';
										break;
									case 0:
										 x ='<span class="blue">审核中<span>';
										break;
									default:
										 x ='<span class="green">已通过<span>';
										break;
								}
								
								$this.identityList[i].status = x;
								
							})
						clickTr();//选中效果
						}
					}
				})
			},
			changeType:function(){//select 改变
				this.getList();
			}
		},
		watch:{
			
		}
	})
	// $(document).ready(function(){
	// 	clickTr();
	// })
	// 
	function clickTr(){
		setTimeout(function(){
			$('.table tbody tr').click(function(){
				DX.clickTr($(this));
			})
		},100);
	}
</script>